import {
    login
} from "@/api/login";

/* 
password: "123456",
    username: "13868171103",
    13600547214  //wkk
    13588058042 //jwg
    13706814055
    18072266573, //jie
    18248608382 //cao
    18058703578 //cdd
    15857182976 //ww
    13868529891 //cqc
    15728002892 //测试
    */
export const toLogin = async function (self) {
    await login({
            "browser": "chrome",
            "name": "13868529891",
            "operateSystem": "windows",
            "password": "123456",
            "username": "13706854828",
            "year": 2021
        }).then((res) => {
        if (res.code === 200 && res.success) {
            localStorage.setItem('roleNow', res.data.roleIdList[0].children[0].name)
            localStorage.setItem('roleIdList', JSON.stringify(res.data.roleIdList[0].children))
            localStorage.setItem('token', res.token)
            localStorage.setItem('userId', res.data.id)
            localStorage.setItem('userName', res.data.trueName)
            localStorage.setItem('enterpriseId', res.data.enterprise[0] && res.data.enterprise[0].code || '')
            self.pageInit && self.pageInit()
        }
    });
}
// toLogin()